package model

import (
	"gluenet/internal/glue-srvm/pkg/gluehttp"
	"time"
)

// MeteringExpense 费用表
type MeteringExpense struct {
	Id                   uint64     `gorm:"primary_key" json:"id"`
	ExpenseId            string     `gorm:"column:expense_id" json:"expense_id"`                         //费用id
	ResourceName         string     `gorm:"column:resource_name" json:"resource_name"`                   //资源名称
	ResourceType         int        `gorm:"column:resource_type" json:"resource_type"`                   //资源类型
	ChargeType           int        `gorm:"column:charge_type" json:"charge_type"`                       //计费类型
	UseType              int        `gorm:"column:use_type" json:"use_type"`                             //使用类型
	Usage                int        `gorm:"column:usage" json:"usage"`                                   //使用量
	ConsumptionStartTime time.Time  `gorm:"column:consumption_start_time" json:"consumption_start_time"` //消费开始时间
	ConsumptionEndTime   time.Time  `gorm:"column:consumption_end_time" json:"consumption_end_time"`     //消费结束时间
	BillingTime          time.Time  `gorm:"column:billing_time" json:"billing_time"`                     //计费时间
	ConsumptionAmount    float64    `gorm:"column:consumption_amount" json:"consumption_amount"`         //消费金额
	AmountOwed           float64    `gorm:"column:amount_owed" json:"amount_owed"`                       //欠费金额
	CreatedAt            time.Time  `gorm:"column:created_at" json:"created_at"`                         //创建时间
	UpdatedAt            time.Time  `gorm:"column:updated_at" json:"updated_at"`                         //更新时间
	DeletedAt            *time.Time `gorm:"column:deleted_at" json:"deleted_at"`                         //删除时间
}

type ExpenseReq struct {
	gluehttp.PageRequest
	Id                   uint64     `gorm:"primary_key" json:"id"`
	ExpenseId            string     `gorm:"column:expense_id" json:"expense_id"`                         //费用id
	ResourceName         string     `gorm:"column:resource_name" json:"resource_name"`                   //资源名称
	ResourceType         int        `gorm:"column:resource_type" json:"resource_type"`                   //资源类型
	ChargeType           int        `gorm:"column:charge_type" json:"charge_type"`                       //计费类型
	UseType              int        `gorm:"column:use_type" json:"use_type"`                             //使用类型
	Usage                int        `gorm:"column:usage" json:"usage"`                                   //使用量
	ConsumptionStartTime time.Time  `gorm:"column:consumption_start_time" json:"consumption_start_time"` //消费开始时间
	ConsumptionEndTime   time.Time  `gorm:"column:consumption_end_time" json:"consumption_end_time"`     //消费结束时间
	BillingTime          time.Time  `gorm:"column:billing_time" json:"billing_time"`                     //计费时间
	ConsumptionAmount    int        `gorm:"column:consumption_amount" json:"consumption_amount"`         //消费金额
	AmountOwed           int        `gorm:"column:amount_owed" json:"amount_owed"`                       //欠费金额
	CreatedAt            time.Time  `gorm:"column:created_at" json:"created_at"`                         //创建时间
	UpdatedAt            time.Time  `gorm:"column:updated_at" json:"updated_at"`                         //更新时间
	DeletedAt            *time.Time `gorm:"column:deleted_at" json:"deleted_at"`                         //删除时间
}

func (e MeteringExpense) TableName() string {
	return "metering_expense"
}

type MeteringExpenseResp struct {
	Id                   uint64     `json:"id"`
	ExpenseId            string     `json:"expense_id"`             //费用id
	ResourceName         string     `json:"resource_name"`          //资源名称
	ResourceType         string     `json:"resource_type"`          //资源类型
	ChargeType           string     `json:"charge_type"`            //计费类型
	UseType              string     `json:"use_type"`               //使用类型
	Usage                int        `json:"usage"`                  //使用量
	ConsumptionStartTime time.Time  `json:"consumption_start_time"` //消费开始时间
	ConsumptionEndTime   time.Time  `json:"consumption_end_time"`   //消费结束时间
	BillingTime          time.Time  `json:"billing_time"`           //计费时间
	ConsumptionAmount    float64    `json:"consumption_amount"`     //消费金额
	AmountOwed           float64    `json:"amount_owed"`            //欠费金额
	CreatedAt            time.Time  `json:"created_at"`             //创建时间
	UpdatedAt            time.Time  `json:"updated_at"`             //更新时间
	DeletedAt            *time.Time `json:"deleted_at"`             //删除时间
}

type ExpensePageResp struct {
	Page gluehttp.PageResponse `json:"page"`
	Data []MeteringExpenseResp `json:"data"`
}
